package com.prs.crm.domain.official;

import java.util.Date;
import java.util.List;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;

import com.prs.crm.domain.Attachment;
import com.prs.crm.domain.BaseEntity;
import com.prs.crm.domain.hr.Person;

/**
 * 已收部门邮件
 * @author yanghao 2012-8-27 14:15:54
 *
 */
@Entity
@Table(name="official_deptMailreceive")
public class DeptMailReceive extends BaseEntity{
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Integer id;

	private Integer deptMailId;
	private String sendPerson;  //发送人
	private String sendPersonAdress;
	@OneToOne
	private Person receivePerson;  //接收人
	private String chaoPerson;
	private String state;  //是否已读
	
	private Integer type; 
	private String lastPerson;
	private Date lastTime;
	private String title;
	private String mailType;
	@Lob
	private String content;
	
	@ManyToOne(fetch=FetchType.LAZY)
	@Cascade({org.hibernate.annotations.CascadeType.ALL,org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
	private Attachment attach; 
	@OneToMany(fetch=FetchType.LAZY,mappedBy="deptMailReceive")
	@Cascade({org.hibernate.annotations.CascadeType.ALL,org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
	private List<DeptMailComment> deptMailComment;
	@OneToMany(fetch=FetchType.LAZY,mappedBy="deptMailReceive")
	@Cascade({org.hibernate.annotations.CascadeType.ALL,org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
	private Set<DeptMailDel> deptMailDel;
	private Integer commentNum;
	public Integer getCommentNum() {
		return commentNum;
	}
	public void setCommentNum(Integer commentNum) {
		this.commentNum = commentNum;
	}
	public Set<DeptMailDel> getDeptMailDel() {
		return deptMailDel;
	}
	public void setDeptMailDel(Set<DeptMailDel> deptMailDel) {
		this.deptMailDel = deptMailDel;
	}
	public String getSendPersonAdress() {
		return sendPersonAdress;
	}
	public void setSendPersonAdress(String sendPersonAdress) {
		this.sendPersonAdress = sendPersonAdress;
	}
	public String getChaoPerson() {
		return chaoPerson;
	}
	public void setChaoPerson(String chaoPerson) {
		this.chaoPerson = chaoPerson;
	}
	public List<DeptMailComment> getDeptMailComment() {
		return deptMailComment;
	}
	public void setDeptMailComment(List<DeptMailComment> deptMailComment) {
		this.deptMailComment = deptMailComment;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getMailType() {
		return mailType;
	}
	public void setMailType(String mailType) {
		this.mailType = mailType;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public Attachment getAttach() {
		return attach;
	}
	public void setAttach(Attachment attach) {
		this.attach = attach;
	}
	public String getLastPerson() {
		return lastPerson;
	}
	public void setLastPerson(String lastPerson) {
		this.lastPerson = lastPerson;
	}
	public Date getLastTime() {
		return lastTime;
	}
	public void setLastTime(Date lastTime) {
		this.lastTime = lastTime;
	}
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getSendPerson() {
		return sendPerson;
	}
	public void setSendPerson(String sendPerson) {
		this.sendPerson = sendPerson;
	}
	public Person getReceivePerson() {
		return receivePerson;
	}
	public void setReceivePerson(Person receivePerson) {
		this.receivePerson = receivePerson;
	}
	public String getState() {
		return state;
	}
	public void setState(String state) {
		this.state = state;
	}
	public Integer getDeptMailId() {
		return deptMailId;
	}
	public void setDeptMailId(Integer deptMailId) {
		this.deptMailId = deptMailId;
	}
	public Integer getType() {
		return type;
	}
	public void setType(Integer type) {
		this.type = type;
	}
}
